package tech.aistar.service;

import com.github.pagehelper.PageInfo;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
import tech.aistar.entity.trading.Goods;
import tech.aistar.entity.trading.GoodsDetails;
import tech.aistar.entity.trading.GoodsType;
import tech.aistar.entity.trading.Report;

import java.util.List;

/**
 * @author Ace
 * @version 1.0
 * @descriiption:本类用来演示:
 * @date 2019/9/28 0028.
 */
@RunWith(SpringRunner.class)
@SpringBootTest
public class GoodsServiceTests {
    @Autowired
    private IGoodsService goodsService;
    @Autowired
    private IGoodsTypeService goodsTypeService;

    @Test
    public void findAll2(){
        PageInfo<Goods> pageInfo=goodsService.findAll2(null,null,1,24);
        System.out.println(pageInfo.getPageNum());
        pageInfo.getList().forEach(System.out::println);
    }
    @Test
    public void findtypeall(){
        List<GoodsType> list=goodsTypeService.findAll();
        list.forEach(System.out::println);
    }
    @Test
    public void update(){
        Goods g=goodsService.findById(24);
        g.setPrice(666.0);
        goodsService.Update(g);

    }
    @Test
    public void findbygoodsid(){
        GoodsDetails goodsDetails=goodsService.findBygoodsId(1);
        System.out.println(goodsDetails);
    }
    @Test
    public void findReportByuId(){

        Report report= goodsService.findReportByuId("3");
        System.out.println(report);
    }
}
